<?php /* Copyright 2010 Karl R. Wilcox 

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License. */


function makeChg_plant ( $node ) {
  $plant_data = array (
  // TODO Charges add tudor rose, york rose (alba) and lancaster rose
    'rose' => array ( 'width' => 500, 'height' => 500, 'proper' => '#F0F0F0',
        'body' => '
  <path d="M 107,80.7 C 88.2,97.5 67.8,131 72.4,171 43,199 55,230 55.7,250 c -10,39 -42.1,26 -31.4,48 22.1,22 45.7,13 51.4,33 30.3,50 40.3,53 70.3,61 11,32 51,49 69,46 28,11 23,46 41,43 18,-2 0,-24 44,-43 31,8 65,-2 81,-44 40,-10 44,-33 54,-50 9,-14 44,-23 53,-20 9,2 -18,-27 -16,-55 20,-30 15,-104 -25,-114 0,-37 -7,-48 -26,-60.7 -10,-20.7 -5,-41.5 4,-55.7 -28,-2.9 -32,3.5 -66,-5 -33,-16.1 -74,-26.46 -109,-7 -31,-13.4 -52,-4.8 -75,6.2 -24,-5.7 -29,0.8 -54,-12.1 -3,42.1 -13,60.7 -14,60 z" stroke="#000000" stroke-width="15" />
  <path d="m 163,80 c 33,60 33,61 33,61 l 0,0" stroke="#000000" stroke-width="15" />
  <path d="M 89.3,281 C 151,263 149,263 149,263" stroke="#000000" stroke-width="15" />
  <path d="M 370,82.1 C 321,143 319,143 319,143" stroke="#000000" stroke-width="15" />
  <path d="M 435,299 C 358,269 358,269 358,269" stroke="#000000" stroke-width="15" />
  <path d="m 254,339 c 2,84 2,84 2,84" stroke="#000000" stroke-width="15" />
  <g stroke="#000000" stroke-width="8" >
  <path d="m 236,243 c -17,9 -22,34 -36,40 -14,6 -67,-1 -75,17 -8,18 -2,49 25,44 46,-10 35,32 54,50 18,17 34,-25 27,-43 -6,-17 -9,-29 -1,-42 8,-14 23,-23 31,-28 8,-5 -5,5 -5,5" />
  <path d="m 238,208 c -14,-13 -39,-10 -49,-22 -10,-11 -19,-64 -38,-66 -20,-2 -48,13 -35,37 24,41 -19.7,43 -31.1,66 -10.7,22 34.1,25 49.1,13 14,-11 25,-17 39,-14 16,4 29,15 36,21 8,7 -6,-3 -6,-3" />
  <path d="m 284,179 c 6,-18 -7,-40 0,-54 6,-13 51,-43.3 45,-61.4 -7,-19 -32,-38.3 -48,-16.7 -28,38.7 -48,-0.3 -73,-1.2 -25,-0.7 -9,41.3 8,50 16,8.3 26,15.3 29,29.3 3,17 -2,33 -4,42 -4,10 0,-7 0,-7" />
  <path d="m 304,237 c 19,0 36,-19 51,-17 14,1 58,33 73,22 15,-13 25,-43 0,-51 -46,-14 -16,-45 -23,-69 -8,-23.7 -42,5 -45,24 -2,18 -5,30 -18,37 -15,8 -31,9 -40,10 -11,0 6,-2 6,-2" />
  <path d="m 260,273 c 4,18 27,30 28,45 3,14 -18,64 -4,76 16,12 47,14 49,-12 3,-47 40,-25 62,-38 21,-13 -15,-39 -34,-38 -18,2 -30,2 -40,-9 -11,-13 -16,-28 -19,-36 -2,-11 4,5 4,5" />
  <path d="m 144,158 c 5,21 52,47 20,48 -34,2 -39,10 -39,10" />
  <path d="M 289,68.1 C 273,82.5 273,136 257,109 238,79.9 229,79.4 229,79.4" />
  <path d="m 410,209 c -18,-12 -70,3 -48,-20 23,-26 21,-35 21,-35" />
  <path d="m 316,372 c 5,-21 -25,-65 3,-51 32,13 40,8 40,8" />
  <path d="m 160,316 c 21,0 57,-38 50,-8 -6,34 0,40 0,40" /></g>',
        'features' => array (
              'seeded' => array ( 'proper' => '#EFD807',
                      'body' => '
    <path stroke="#000000" stroke-width="2" d="m 234,220 a 24,23.7 0 0 1 -48,0 24,23.7 0 1 1 48,0 z" />
    <path stroke="#000000" stroke-width="5" d="m 225,214 c 0,3 1,11 -3,15 -3,3 -2,3 -5,5" />
    <path stroke="#000000" stroke-width="5" d="m 214,219 c 0,3 -2,10 -4,13 0,1 -5,2 -5,2" />
    <path stroke="#000000" stroke-width="2" d="m 283,175 a 24,23.7 0 0 1 -48,0 24,23.7 0 1 1 48,0 z" />
    <path stroke="#000000" stroke-width="5" d="m 274,170 c 0,3 1,11 -3,15 -3,3 -2,3 -5,5" />
    <path stroke="#000000" stroke-width="5" d="m 263,175 c 0,3 -2,10 -4,13 0,1 -5,2 -5,2" />
    <path stroke="#000000" stroke-width="2" d="m 283,227 a 24,23.7 0 0 1 -48,0 24,23.7 0 1 1 48,0 z" />
    <path stroke="#000000" stroke-width="5" d="m 274,221 c 0,3 1,11 -3,15 -3,3 -2,3 -5,5" />
    <path stroke="#000000" stroke-width="5" d="m 263,226 c 0,3 -2,10 -4,13 0,1 -5,2 -5,2" />
    <path stroke="#000000" stroke-width="2" d="m 337,222 a 24,23.7 0 0 1 -48,0 24,23.7 0 1 1 48,0 z" />
    <path stroke="#000000" stroke-width="5" d="m 328,216 c 0,3 1,11 -3,15 -3,3 -2,3 -5,5" />
    <path stroke="#000000" stroke-width="5" d="m 317,221 c 0,3 -2,10 -4,13 0,1 -5,2 -5,2" />
    <path stroke="#000000" stroke-width="2" d="m 311,277 a 24,23.7 0 0 1 -48,0 24,23.7 0 1 1 48,0 z" />
    <path stroke="#000000" stroke-width="5" d="m 302,272 c 0,3 1,11 -3,15 -3,3 -2,3 -5,5" />
    <path stroke="#000000" stroke-width="5" d="m 291,277 c 0,3 -2,10 -4,13 0,1 -5,2 -5,2" />
    <path stroke="#000000" stroke-width="2" d="m 256,273 a 24,23.7 0 0 1 -48,0 24,23.7 0 1 1 48,0 z" />
    <path stroke="#000000" stroke-width="5" d="m 247,268 c 0,3 1,11 -3,15 -3,3 -2,3 -5,5" />
    <path stroke="#000000" stroke-width="5" d="m 236,273 c 0,3 -2,10 -4,13 0,1 -5,2 -5,2" />',
                       ),
              'barbed' => array ( 'proper' => '#149414',
                      'body' => '<g stroke="#000000" stroke-width="5" >
  <path  d="m 186,123 c -7,7 -3,12 4,41 8,10 19,32 31,5 6,-14 -3,-21 -10,-34 -18,-24 -25,-11 -25,-12 z" />
  <path  d="m 332,120 c -9,-2 -12,4 -33,24 -5,12 -18,33 11,30 15,-2 17,-14 24,-26 12,-28 -3,-27 -2,-28 z" />
  <path  d="m 389,273 c 0,-9 -6,-11 -29,-28 -13,-3 -35,-13 -28,15 4,15 17,15 29,20 30,7 26,-8 28,-7 z" />
  <path  d="m 261,357 c 8,-3 8,-9 14,-37 -2,-13 -1,-37 -24,-19 -12,9 -7,21 -7,34 5,30 17,20 17,22 z" />
  <path  d="m 135,264 c 4,8 10,6 38,6 13,-4 36,-8 14,-27 -12,-10 -22,-2 -35,0 -28,11 -16,21 -17,21 z" />
  <path  d="m 49.5,294 c 3.2,-1 13.4,-6 15.1,-7 4.1,-2 11,-3 15.2,-5" />
  <path  d="m 77.8,293 c 3.3,-2 -8.6,1 -14.2,7 -2.8,3 -3.3,4 -4,8" />
  <path  d="M 105,275 C 85.3,293 85.4,301 75.2,329 56.1,306 42.9,300 29.8,299 c -14.7,-2 26.3,-8 25.7,-45 -0.3,-22 16.7,27 49.5,21 z" />
  <path  d="m 80.8,280 c -1.5,2 -8.1,3 -13.1,3 -4.7,0 -9.3,1 -13.2,-1" />
  <path  d="m 82.3,289 c -1.9,-1 -8.2,-1 -11.6,0 -3.7,1 -7.3,2 -10.1,3 -1.4,1 -3.1,3 -4,3" />
  <path  d="m 257,454 c 0,-3 -3,-15 -3,-17 -1,-4 0,-11 -1,-15" />
  <path  d="m 263,426 c -1,-3 -1,9 3,16 2,3 3,4 7,6" />
  <path  d="m 253,395 c 12,24 20,26 44,44 -27,12 -36,23 -41,35 -6,14 0,-27 -36,-37 -21,-5 30,-8 33,-42 z" />
  <path  d="m 252,420 c 1,2 0,9 -1,13 -1,5 -2,10 -5,13" />
  <path  d="m 261,421 c -2,2 -4,8 -3,11 -1,4 -1,8 0,11 0,1 2,3 1,4" />
  <path  d="m 464,309 c -3,-1 -14,-4 -16,-4 -4,-1 -10,-5 -15,-6" />
  <path  d="m 442,292 c -4,-1 7,5 15,4 4,-1 5,-1 8,-4" />
  <path  d="m 410,288 c 26,-1 31,-7 57,-22 0,30 6,43 15,52 10,11 -25,-11 -49,17 -14,17 5,-31 -23,-47 z" />
  <path  d="m 431,300 c 3,-1 8,3 12,6 4,3 8,5 9,9" />
  <path  d="m 436,292 c 1,2 5,6 9,7 3,2 6,4 9,5 2,0 4,-1 5,0" />
  <path  d="m 390,58.1 c -3,2.4 -9,11.8 -9,13.5 -3,3.8 -8,8.1 -11,11.9" />
  <path  d="m 366,73.2 c -1,3.4 7,-5.1 9,-13 1,-4 1,-5 -1,-8.8" />
  <path  d="m 353,102 c 7,-25 3,-31.6 -3,-60.3 28,9.6 42,8 54,2.2 13,-5.7 -18,20 1,50.8 11,18.3 -28,-14.2 -52,7.3 z" />
  <path  d="m 370,85.7 c 1,-2.5 6,-6.6 10,-9.2 4,-2.3 7,-5.5 12,-5.8" />
  <path  d="m 365,78.9 c 2,-0.1 7,-3.3 9,-5.9 3,-2.7 5,-5.4 7,-7.6 1,-1.6 1,-4.1 2,-4.6" />
  <path  d="m 135,53.7 c 2,2.6 10,10.2 12,11.4 3,3 7,9 10,12.1" />
  <path  d="m 146,79.2 c 3,2.3 -4,-7.5 -11,-10.6 -4,-1.5 -5,-1.6 -9,-0.9" />
  <path  d="M 172,97.8 C 149,86 141,88.9 112,89.2 c 15,-25.4 16,-39.5 12,-51.8 -3,-14.1 16,21.3 50,8 20,-7.9 -19,24.5 -2,52.4 z" />
  <path  d="m 159,77.5 c -2,-0.7 -6,-6.4 -7,-11 -2,-4.3 -4,-8.1 -4,-12.4" />
  <path  d="m 151,81.9 c 1,-2.1 -2,-7.8 -4,-10.6 -2,-3 -4,-6 -6,-8.2 -1,-0.9 -4,-1.8 -4,-2.6" /></g>',),
              )
        ),

'thistle' => array ( 'width' => 392, 'height' => 448, 'proper' => '#965578', 'orient_to_ordinary' => true, 'hflex' => 1.4, 'wflex' => 1.2, 'body' =>
    '<path stroke="#000000" stroke-width="4" d="m 221,142 c -14,-9 47,-43.8 50,-60 4,-16.2 -47,-19.1 -72,-17.7 -24,-1.4 -75,1.5 -72,17.7 4,16.2 65,51 51,60 -8,6 43,13 43,0 z"/>
    <g fill="none" stroke="#000000" stroke-width="4" >
    <path d="M 151.05,79.57 L 165.78,101.68" />
    <path d="M 172.42,77.36 L 176.10,101.68" />
    <path d="M 189.36,76.63 L 188.63,100.21" />
    <path d="M 206.31,76.63 L 199.68,100.94" />
    <path d="M 224.73,78.84 L 215.15,102.42" />
    <path d="M 238,79.57 L 226.21,103.15" />
    <path d="M 257.15,198.94 C 259.36,219.57 252.73,249.78 232.10,252" />
    <path d="M 247.02,200.23 C 249.26,216.99 242.53,241.54 221.60,243.34" />
    <path d="M 237.07,204.27 C 239.38,214.45 232.45,229.36 210.90,230.45" /></g>',
'features' => array (
   'slipped' => array ( 'proper' => '#149414' , 'body' => '<path stroke="#000000" stroke-width="4"  d="M 202.63,278.52 L 187.89,299.89 L 182.73,326.42 L 190.84,339.68 L 181.26,364.73 L 184.94,387.57 L 179.78,432.52 L 195.26,442.84 L 224,431.05 L 227.68,397.15 L 227.68,381.68 L 214.42,357.36 L 227.68,338.94 L 221.05,321.26 L 226.21,296.21 L 229.89,282.21 L 202.63,278.52 z" />
      <path  stroke="#000000" stroke-width="4"  d="m 199,270 c 7,-2 64,2 68,-58 7,-37 -33,-61 -46,-70 28,-11 -63,-10 -43,0 -13,9 -53,33 -46,70 4,60 61,56 67,58 z" />
      <g fill="none" stroke="#000000" stroke-width="4" >
      <path  d="M 213.68,294.73 C 212.21,299.15 198.21,327.89 198.21,327.89" />
      <path  d="M 210.73,341.15 L 198.21,377.26" />
      <path  d="M 257,199 c 2,21 -4,51 -25,53" />
      <path  d="M 247,200 c 2,17 -4,42 -25,43" />
      <path  d="M 237,204 c 2,10 -5,25 -26,26" />
      <path  d="M 207.78,389.05 L 209.26,420.73" /></g>' ),
    'leaved' => array ( 'proper' => '#149414' , 'body' => '<g stroke="#000000" stroke-width="4" >
  <path d="m 177,369 -8,-27 -16,3 -6,-12 -16,-23 -16,9 -48.7,-17 -0.7,19 -17,-6 5.9,43 20.7,10 -14.8,34 25.8,-23 21.8,17 -3,24 33,-25 23,13 21,-23"   />
  <path d="m 232,365 8,-27 16,3 6,-12 16,-23 16,9 49,-17 0,19 17,-6 -5,43 -21,10 15,34 -26,-23 -22,17 3,24 -33,-25 -23,13 -21,-23"   />
  <path d="m 61.9,294 17.7,-15 33.4,9 0,-35 L 92.8,239 111,217 97.3,192 c 0,0 5.7,-8 8.7,-11 3,-3 -10.2,-28 -10.2,-28 L 122,141 92.8,121 c 0,0 -6.6,-34.8 -6.6,-37.7 0,-3 11.8,-17 11.8,-17 L 66.3,22.1 56.7,43.5 65.6,83.3 38.3,100 l 19.9,37 -39.1,3 0.8,74 27.2,25 -34.6,10 -2.93,42 52.33,3 z"   />
  <path d="m 343,296 -18,-15 -33,9 0,-35 20,-14 -18,-22 14,-25 c 0,0 -6,-8 -9,-11 -3,-3 10,-28 10,-28 l -26,-12 29,-20 c 0,0 7,-34.6 7,-37.5 0,-3 -12,-17 -12,-17 l 32,-44.2 9,21.4 -9,39.8 28,16.5 -20,37 39,3 -1,74 -27,25 35,10 2,42 -52,3 z"   />
  </g><g stroke="#000000" stroke-width="4" fill="none" >
  <path d="M 178,382 133,372 102,351 68.5,326"   />
  <path d="m 87.7,323 5.9,20"   />
  <path d="m 124,328 -1,36"   />
  <path d="m 166,354 -19,17"   />
  <path d="M 81.8,372 104,356"   />
  <path d="m 118,391 9,-20"   />
  <path d="m 231,378 45,-10 31,-21 34,-25"   />
  <path d="m 321,319 -6,20"   />
  <path d="m 285,324 1,36"   />
  <path d="m 243,350 19,17"   />
  <path d="M 327,368 305,352"   />
  <path d="m 291,387 -9,-20"   />
  <path d="M 63.4,290 67,219 66.3,170 74.4,113 75.2,59.7"   />
  <path d="m 35.4,149 32.4,22"   />
  <path d="M 27.3,194 67,219"   />
  <path d="M 23.6,279 64.8,248"   />
  <path d="M 103,273 67.8,241"   />
  <path d="m 66.3,230 28,-16"   />
  <path d="M 67.8,195 94.3,175"   />
  <path d="m 74.4,133 24.3,6"   />
  <path d="M 72.9,115 50.1,102"   />
  <path d="m 65.6,39 9.6,19.9 17.6,7.4"   />
  <path d="m 342,292 -4,-71 1,-49 -8,-57 -1,-53.1"   />
  <path d="m 370,151 -33,22"   />
  <path d="m 378,196 -40,25"   />
  <path d="M 381,281 340,250"   />
  <path d="m 302,275 35,-32"   />
  <path d="M 339,232 311,216"   />
  <path d="M 337,197 311,177"   />
  <path d="m 331,135 -25,6"   />
  <path d="m 332,117 23,-13"   />
  <path d="m 339,41.2 -9,19.9 -18,7.4"   /></g>' ),
)), // TODO Charges add other foil types
'cinquefoil' => array ( 'width' => 125, 'height' => 121,
    'body' => '<path fill-rule="evenodd" stroke="#000000" stroke-width="2" d="M 50.31,70.54 C 50.17,63.15 37.93,65.13 35.38,70.69 C 35.05,71.42 18.83,84.54 9.30,67.45 C 7.50,56.66 0.48,60.62 1.02,50.19 C 1.50,41.04 3.00,47.67 13.08,39.93 C 18.16,31.81 26.80,31.59 35.92,35.79 C 43.04,39.07 38.62,59.18 53.61,53.66 C 60.11,51.26 54.75,40.92 48.73,39.82 C 47.94,39.67 31.25,27.17 45.48,13.74 C 55.51,9.35 49.95,3.52 60.20,1.48 C 69.18,-0.29 63.13,2.79 73.09,10.66 C 82.21,13.59 84.54,21.92 82.70,31.79 C 81.27,39.50 56.73,44.36 71.15,54.49 C 85.44,64.52 80.66,40.09 87.23,35.81 C 95.65,30.33 104.23,29.28 110.44,36.58 C 121.53,42.77 122.05,35.99 123.85,44.98 C 125.90,55.22 118.39,52.32 118.17,63.26 C 111.23,81.56 93.28,70.93 92.84,70.26 C 89.51,65.12 79.37,65.60 77.17,71.25 C 74.76,77.43 83.38,82.49 88.86,79.78 C 89.58,79.43 110.44,79.49 107.04,98.77 C 101.62,108.27 109.56,109.63 102.55,117.38 C 96.41,124.17 99.43,118.08 86.73,117.72 C 77.66,120.81 70.83,115.52 66.41,106.50 C 62.95,99.46 79.16,86.58 63.64,81.54 C 56.82,79.32 54.47,90.83 58.48,95.46 C 59.00,96.06 64.22,116.26 44.72,117.85 C 34.15,115.01 34.84,123.04 25.57,118.22 C 17.44,114.00 24.10,115.37 21.24,103.00 C 15.95,95.01 19.34,87.06 26.94,80.50 C 32.88,75.37 50.61,87.27 50.31,70.54 z M 59.85,62.24 C 62.74,58.24 70.82,64.04 65.96,67.99 C 61.19,71.88 56.79,66.47 59.85,62.24 z"/>', ),
'trefoil' => array ( 'width' => 500, 'height' => 500, 'body' => '    <path
       d="M 256.1,9.375 C 172.,44.29 120.6,132.6 240.9,175.6 C 244.2,210.6 218.,210.9 205.,211.2 C 141.4,95.43 21.33,158.8 8.731,214.8 C 25.55,276.2 106.4,377.8 206.7,234.1 C 229.3,240.3 237.7,260.4 224.1,298.8 C 211.1,334.5 202.8,356.7 228.,410.4 C 254.2,464.1 248.,483.8 248.,489.3 C 296.9,426.5 231.6,378.1 249.7,341.2 C 267.8,303.3 267.8,225.4 300.1,232.2 C 408.5,377.4 487.6,266.2 499.4,208.6 C 475.7,137.2 346.4,89.62 301.4,215.959 C 271.,212.8 264.2,219.9 264.6,171.7 C 298.9,177.9 420.8,98.97 256.1,9.375 z"
       fill-rule="evenodd" stroke="#000000" stroke-width="5" />
    <g fill="none" stroke="#000000" stroke-width="3">
    <path d="M 164.,180.1 C 224.8,273.9 88.94,284.6 88.94,284.6" />
    <path d="M 468.3,176.2 C 502.,306.7 366.3,273.6 366.7,273.2" />
    <path d="M 313.8,68.85 C 345.2,178.248 222.4,142.3 222.8,142.9" />
    <path d="M 457.3,177.6 C 489.7,292.5 360.4,263. 360.1,263.4" />
    <path d="M 306.7,68.18 C 336.6,167.3 223.1,135.3 223.7,134.6" />
    <path d="M 156.4,181.8 C 209.5,263.1 89.63,273.3 89.63,273.3" /></g>',)

);
  $type = $node->get_attribute('subtype');
  if ( isset($plant_data[$type]) ) {
      return $plant_data[$type];
  } else {
    my_trigger_error ( "No plant $type", E_USER_WARNING, __FILE__, __LINE__ );
    return null;
  }
}
?>
